

import { rank } from '../../templates/canvas.js';

const pageConfig = ({
  data: {
    homeData: null,
    imgSRC: ''
  },
  onLoad: function (options) {
    let id = options.score;
    let data = '';
    let _this = this;
    wx.getStorage({
      key: 'productData',
      success: function (res) {
        console.log(res.data.score.same_scores)
        let da = res.data.score.same_scores;
        da.map(res => {
          if (res.id == id) {
            _this.setData({
              homeData: res
            })
          }
        })
      }
    })


  },
  onReady: function () {
    let _this = this;
    console.log(this.data.homeData)
    rank('rank', this.data.homeData.averageScore).then(res => {
      _this.setData({
        imgSRC: res
      })
    })
  }

});


Page(pageConfig);
